package com.ly.heart.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ly.common.utils.DateUtils;
import com.ly.common.utils.erp.SnowflakeIdWorker;
import com.ly.heart.domain.SurveyCostEntity;
import com.ly.heart.mapper.SurveyCostMapper;
import com.ly.heart.service.ISurveyCostService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 勘测申请费用明细Service业务层处理
 *
 * @author wutao
 * @date 2024-05-22
 */
@Service
public class SurveyCostServiceImpl extends ServiceImpl<SurveyCostMapper, SurveyCostEntity> implements ISurveyCostService {

    @Resource
    private SurveyCostMapper erpSurveyCostInfoMapper;

    /**
     * 查询勘测申请费用明细
     *
     * @param id 勘测申请费用明细ID
     * @return 勘测申请费用明细
     */
    @Override
    public SurveyCostEntity selectErpSurveyCostInfoById ( String id ) {
        return erpSurveyCostInfoMapper.selectErpSurveyCostInfoById ( id );
    }

    /**
     * 查询勘测申请费用明细列表
     *
     * @param erpSurveyCostInfo 勘测申请费用明细
     * @return 勘测申请费用明细
     */
    @Override
    public List<SurveyCostEntity> selectErpSurveyCostInfoList ( SurveyCostEntity erpSurveyCostInfo ) {
        return erpSurveyCostInfoMapper.selectErpSurveyCostInfoList ( erpSurveyCostInfo );
    }

    /**
     * 新增勘测申请费用明细
     *
     * @param erpSurveyCostInfo 勘测申请费用明细
     * @return 结果
     */
    @Override
    public int insertErpSurveyCostInfo ( SurveyCostEntity erpSurveyCostInfo ) {
        erpSurveyCostInfo.setId ( SnowflakeIdWorker.getInstance ().nextStringId () );
        erpSurveyCostInfo.setCreateTime ( DateUtils.getNowDate () );
        return erpSurveyCostInfoMapper.insertErpSurveyCostInfo ( erpSurveyCostInfo );
    }

    /**
     * 修改勘测申请费用明细
     *
     * @param erpSurveyCostInfo 勘测申请费用明细
     * @return 结果
     */
    @Override
    public int updateErpSurveyCostInfo ( SurveyCostEntity erpSurveyCostInfo ) {
        erpSurveyCostInfo.setChangeTime ( DateUtils.getNowDate () );
        return erpSurveyCostInfoMapper.updateErpSurveyCostInfo ( erpSurveyCostInfo );
    }

    /**
     * 批量删除勘测申请费用明细
     *
     * @param ids 需要删除的勘测申请费用明细ID
     * @return 结果
     */
    @Override
    public int deleteSurveyCostInfoByIds ( String[] ids ) {
        return erpSurveyCostInfoMapper.deleteErpSurveyCostInfoByIds ( ids );
    }

    @Override
    public int deleteSurveyCostByApplyIds (String surveyApplyId) {
        return erpSurveyCostInfoMapper.deleteSurveyCostByApplyIds ( surveyApplyId );
    }

    /**
     * 删除勘测申请费用明细信息
     *
     * @param id 勘测申请费用明细ID
     * @return 结果
     */
    @Override
    public int deleteErpSurveyCostInfoById ( String id ) {
        return erpSurveyCostInfoMapper.deleteErpSurveyCostInfoById ( id );
    }
}
